<?php
/**
 * Created by PhpStorm.
 * User: wangye
 * Date: 19-2-14
 * Time: 下午7:09
 */

$socket = stream_socket_server("tcp://127.0.0.1:8052",$error,$errstr);

if (!$socket){
    echo "$error,$errstr";
}
while (true){
    $client = stream_socket_accept($socket,-1);
    if ($client){
        $http = fread($client,1024);
        $content = "HTTP/1.1 200 OK\r\n
        Server:http_dollarkiller/1.0.0\r\n
        Content-Length:".strlen($http)."\r\n\r\n{$http}";
        fwrite($client,$content);
    }
    fclose($client);
}
fclose($socket);
